#ifndef LISTITER_INCLUDED
#define LISTITER_INCLUDED

typedef struct List_t List;
typedef struct ListIter_t* ListIter;
typedef ListIter Iter;

/*  If failed return 0, and prints to stderr                            */
List*   ListNew(void)           ;
void    ListDelete(List* )      ;

/*  Return iterator to the begin of data                                */
Iter    ListBegin(List*)        ;

/*  Return iterator to the end (after data)                             */
Iter    ListEnd(List*)          ;
void*   ListGetData(Iter)       ;

/*  Insert before the param iterator, return iterator to inserted data  */
Iter    ListInsert(Iter, void*) ;

/*  Remove the data pointed by iterator, return iterator to next data   */
Iter    ListRemove(Iter)        ;
Iter    ListNext(Iter)          ;
Iter    ListPrev(Iter)          ;
int     ListIsEmpty(List*)      ;
int     ListIterIsEqual(Iter , Iter);

/*  Count the list items. Works in complexibility of O(n)               */
size_t  ListCount(List*)        ;

typedef int(*Func)(void* _data, void* _param);
void ListForEach(Iter _beginIt, Iter _endIt, Func, void* _param);

#endif /* LISTITER_INCLUDED */
